package com.znyj.servlet.model;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import java.sql.Timestamp;

/**
 * Created by gaoliwei02 on 2017/9/22.
 */
public class MerchantQueryModel {

    private String group = "";
    private String order = "DESC";
    private int limit = 0;
    private int offset = 0;
    private int pageSize = 15;
    private int pageNumber = 0;

    private long poiid;
    private String bdName;
    private String merchantName;

    public MerchantQueryModel(String receiveData) {
        JSONObject receive = JSON.parseObject(receiveData);

        order = receive.getString("order");
        limit = receive.getInteger("limit");
        offset = receive.getInteger("offset");
        try {
            pageSize = Integer.parseInt(receive.getString("pageSize"));
        } catch (Exception e) {
            pageSize = -1;
        }
        try {
            pageNumber = receive.getInteger("pageNumber");
        } catch (Exception e) {
            pageNumber = offset/pageSize + 1;
        }

        bdName = receive.getString("bdName");
        merchantName = receive.getString("merchantName");

        try {
            poiid = Long.parseLong(receive.getString("poiid"));
        } catch (Exception e) {
            poiid = -1;
        }
    }


    public String getGroup() {
        return group;
    }

    public void setGroup(String group) {
        this.group = group;
    }

    public String getOrder() {
        return order;
    }

    public void setOrder(String order) {
        this.order = order;
    }

    public int getLimit() {
        return limit;
    }

    public void setLimit(int limit) {
        this.limit = limit;
    }

    public int getOffset() {
        return offset;
    }

    public void setOffset(int offset) {
        this.offset = offset;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getPageNumber() {
        return pageNumber;
    }

    public void setPageNumber(int pageNumber) {
        this.pageNumber = pageNumber;
    }

    public long getPoiid() {
        return poiid;
    }

    public void setPoiid(long poiid) {
        this.poiid = poiid;
    }

    public String getBdName() {
        return bdName;
    }

    public void setBdName(String bdName) {
        this.bdName = bdName;
    }

    public String getMerchantName() {
        return merchantName;
    }

    public void setMerchantName(String merchantName) {
        this.merchantName = merchantName;
    }

}
